package org.pp.util;

import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.PageInfo;
import org.pp.core.PageBean;

public class PageUtil {


    public static <P> PageBean<P> load(PageInfo<?> pageInfo, Class<P> claz) {
        PageBean<P> bean = new PageBean<>();
        bean.setTotal(pageInfo.getTotal());
        bean.setList(BeanUtil.copyToList(pageInfo.getList(), claz));
        bean.setPages(pageInfo.getPages());
        bean.setPageNum(pageInfo.getPageNum());
        bean.setPageSize(pageInfo.getPageSize());
        return bean;
    }
}
